package com.hc.server.common.config;

import com.hc.server.common.interceptor.CollectorInterceptor;
import com.hc.server.common.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配制所有拦截器
 * Created by wdj on 2024/10/18
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private TokenInterceptor tokenInterceptor;
    @Autowired
    private CollectorInterceptor collectorInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor)
                .addPathPatterns("/hc/**");
        registry.addInterceptor(collectorInterceptor)
                .addPathPatterns("/hc/**");
    }
}
